<template>
	<view>
		<view class="user-container">
			<view class="flex-sub text-center bg-white">
				<view class="solid-bottom text-xl padding">
					<text class="text-black text-bold">张三</text>
				</view>
			</view>
			<view class="openState bg-white">
					<view class="btn">状态: 开门成功</view>
					<view class="btn">时间: 2022-10-21</view>
			</view>
		</view>
		<view class="footer">
			<view @click="mineKey">我的钥匙</view>
			<view @click="openRecord">开门记录</view>
		</view>
	</view>
</template>

<script>
	import context from '../../lib/java110/Java110Context.js'
	const constant = context.constant; //获取app实例
	import conf from '../../conf/config.js'
	//获取app实例
	const app = getApp().globalData;
	
	export default {
		data() {
			return {
				notice: 
					{
						"id":1,
						"name":王五,
						"timeStr":2022-10-21
					},
				communityId:''
			};
		},
		
		onLoad: function(options) {
			// context.onLoad(options);
			// let _noticeId = options.noticeId;
			// this.noticeId = _noticeId;
			// this.communityId = options.communityId;
			// this._loadNoticeDetail();
		},
		onShow: function() {
			let that = this; // that.setData({
			//     userInfo: app.globalData.userInfo
			// });
		},
		methods:{
			mineKey() {
				uni.navigateTo({
					url: "./electronicEntranceGuard"
				})
			},
			openRecord() {
				uni.navigateTo({
					url: "./openRecord"
				})
			},
			_loadNoticeDetail: function() {
					let that = this;
					
					uni.request({
						// header: context.getHeaders(),
						url: "http://localhost:8888/data",
						method: "GET",
						data: {
							communityId: that.communityId,
							page: 1,
							row: 10,
							noticeId: that.noticeId
						},
						success: function(res) {
							// TODO 判断
							console.log(res);
							let notice = res.data.notices[1]
							notice.timeStr = notice.startTime.replace(/:\d{1,2}$/, ' ');
							// notice.context = replaceImgSrc(notice.context,conf.baseUrl);
							that.notice = notice;
						}
					});
				}
			}
		}
	// }
</script>

<style lang="scss" scoped>
	@import "../../pages/notice/detail/detail.css";
	.openState{
		display: flex;
		justify-content: space-around;
		align-items: center;
		.btn{
			width: 40%;
			height: 80rpx;
			text-align: center;
			padding: 20rpx 0rpx;
		}
		
	}

.footer{
		width: 100%;
		position: fixed;
		bottom: 0rpx;
		height: 90rpx;
		display:flex;
		background-color: aliceblue;
		justify-content: space-around;
		align-items: center;
		div{
			width: 40%;
			height: 90rpx;
			text-align: center;
			line-height: 90rpx;
		}
	}
</style>
